﻿using System;
using System.Configuration;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Salesforce.Common;
using Salesforce.Force;

namespace WP_ForceDotCom_Pivot
{
    public class query
    {
        public void doquery() 
        { 
        var status = querycontacts();
        }
      public async Task querycontacts()
    {
        // TODO: You need at least a few contacts added to your Force.com environment to be able to query.
        var client = new ForceClient(Globals.sessionurl, Globals.sessiontoken, Globals.sessionapiversion);
        var results = await client.Query<SObjectTypes.Contact>("SELECT ID, Name from Contact LIMIT 5");
          // perform any further manipulation to the safe results
          StoredResults.Contacts = results; // store back to the public Ilist
          Globals.firstheadername = "contacts"; // update header name
     }
    }
}
